﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WhutDoomCheck.Server.Entities
{
    public class Doom
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        public string Region { get; set; } = null!;

        [Required]
        public string Area { get; set; } = null!;
         
        [Required]
        public string Building { get; set; } = null!;

        [Required]
        public int Floor { get; set; }

        [Required]
        public string RoomNumber { get; set; } = null!;

        [Required]
        public int BedCount { get; set; }

        public override bool Equals(object? obj)
        {
            if (obj is not Doom another) return false;
            return another.Region == Region && another.Area == Area && another.Building == Building && 
                   another.Floor == Floor && another.RoomNumber == RoomNumber;
        }

        public override int GetHashCode()
        {
            return $"{Region} {Area} {Building} {Floor} {RoomNumber}".GetHashCode();
        }
    }
}
